CC = g++ -Wall
RELEASE = 1
UNICODE = 0  
LOADBIN = -L ../WINApt_Logic/WINApt_LogicProtocol -L ../WINApt_Logic/WINApt_LogicSql -L /usr/local/lib/NetEngine_Release/NetEngine_BaseLib -L /usr/local/lib/NetEngine_Release/NetEngine_Core -L /usr/local/lib/NetEngine_Release/NetEngine_HelpComponents
LIB = -lWINApt_LogicProtocol -lWINApt_LogicSql -lNetEngine_BaseLib -lNetEngine_Core -lNetEngine_ManagePool -lHelpComponents_XLog -lHelpComponents_Packet
LIBEX = -static-libgcc -ldl -lrt -lpthread
LOADSO = -Wl,-rpath=./WINApt_Shared:./WINApt_Logic
LIBINCLUDE = WINApt_Config.o WINApt_Handle.o WINApt_Net.o WINApt_Main.o

ifeq ($(RELEASE),1)
FLAGS = -c -O2 
DEBUG = 
else
FLAGS = -c -lc_p
DEBUG = -g -pg 
endif

ifeq ($(UNICODE),1)
UNICODE = -D _UNICODE
else
UNICODE = 
endif

all:$(LIBINCLUDE)
	$(CC) $(DEBUG) $(LIBINCLUDE) -o WINApt_ServerApp $(LOADBIN) $(LIB) $(LIBEX) $(LOADSO)
  
WINApt_Config.o:./WINApt_Config.cpp
	$(CC) $(DEBUG) $(FLAGS) $(UNICODE) ./WINApt_Config.cpp 
WINApt_Handle.o:./WINApt_Handle.cpp
	$(CC) $(DEBUG) $(FLAGS) $(UNICODE) ./WINApt_Handle.cpp
WINApt_Net.o:./WINApt_Net.cpp
	$(CC) $(DEBUG) $(FLAGS) $(UNICODE) ./WINApt_Net.cpp 
WINApt_Main.o:./WINApt_Main.cpp             
	$(CC) $(DEBUG) $(FLAGS) $(UNICODE) ./WINApt_Main.cpp   


InstallAll:InstallApp
InstallApp:./WINApt_ServerApp
	cp -f ./WINApt_ServerApp ../../WINApt_Release/WINApt_ServerApp
InstallSo:
	cp -f ../../NetEngine_Release/NetEngine_Release/NetEngine_BaseLib/libNetEngine_BaseLib.so ./NetEngine_StreamMedia/StreamMedia_Shared/libNetEngine_BaseLib.so
	cp -f ../../NetEngine_Release/NetEngine_Release/NetEngine_BaseLib/libNetEngine_Algorithm.so ./NetEngine_StreamMedia/StreamMedia_Shared/libNetEngine_Algorithm.so
	cp -f ../../NetEngine_Release/NetEngine_Release/NetEngine_Core/libNetEngine_Core.so ./NetEngine_StreamMedia/StreamMedia_Shared/libNetEngine_Core.so
	cp -f ../../NetEngine_Release/NetEngine_Release/NetEngine_Core/libNetEngine_ManagePool.so ./NetEngine_StreamMedia/StreamMedia_Shared/libNetEngine_ManagePool.so
	cp -f ../../NetEngine_Release/NetEngine_Release/NetEngine_HelpComponents/libHelpComponents_XLog.so ./NetEngine_StreamMedia/StreamMedia_Shared/libHelpComponents_XLog.so
	cp -f ../../NetEngine_Release/NetEngine_Release/NetEngine_SystemSdk/libNetEngine_ProcSdk.so ./NetEngine_StreamMedia/StreamMedia_Shared/libNetEngine_ProcSdk.so
	cp -f ../../NetEngine_Release/NetEngine_Release/NetEngine_SystemSdk/libNetEngine_SystemApi.so ./NetEngine_StreamMedia/StreamMedia_Shared/libNetEngine_SystemApi.so
	
CleanAll:CleanObj CleanMk
CleanObj:                                              
	rm *.o
CleanMk:                                  
	rm WINApt_ServerApp     
CleanSo:
	rm ./WINApt_ServerApp
	rm ../../WINApt_Release/WINApt_Shared/*.so
	       
